<?php
namespace app\article\validate;
use think\Validate;
class CategoryMoveTo extends Validate {
    //验证字段
    protected $rule = [
        'son_id' => ['require','number'],
        'parent_id' => ['require','number'],
        'creater' => ['require','number'],
        'create_time' => ['require'],
        'id' => ['require','number'],
    ];
    //返回消息
    protected $message = [
        'son_id.require' => '子id必须',
        'son_id.number' => '子id不是数字',
        'parent_id.require' => '父id必须',
        'parent_id.number' => '父id不是数字',
        'creater.require' => '创建者必须',
        'creater.number' => '创建者不是数字',
        'create_time.require' => '创建时间必须',
        'id.require' => 'id必须',
        'id.number' => 'id不是数字',
    ];

    // except_id 场景
    public function sceneExcept_id(){
        return $this->only(['son_id','parent_id','creater','create_time']);
    }

    // only_id 场景
    public function sceneOnly_id(){
        return $this->only(['id']);
    }

    // all_field 场景
    public function sceneAll_field(){
        return $this->only(['id','son_id','parent_id','creater','create_time']);
    }
}
